/*
 * 展示物料采购入库交易
 * 参数   交易码：trancode=51110
 */

package org.ccams.tran;


import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.ccams.domain.TInhead;
import org.ccams.util.ConvertUtil;
import org.ccams.util.PageParameter;

public class Tran51110 extends AbstractJsonTran {

	@SuppressWarnings("unchecked")
	public void buildJSONObject(Map model, JSONObject json,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		int limit = Integer.parseInt(request.getParameter("limit"));
		int start = Integer.parseInt(request.getParameter("start"));
		String keyWords = request.getParameter("query");
		String keyWords1 = request.getParameter("keywords");
		String keyWords2 = request.getParameter("keywords2");
		PageParameter page = new PageParameter();
		page.setLimit(limit);
		page.setStart(start);
		page.setKeyWords(keyWords);
		page.setStartDT(keyWords1);
		page.setEndDT(keyWords2);
		int count = getCcamsService().getTinheadDao().getCount(page);
		List<TInhead> list = getCcamsService().getTinheadDao().getByPage(page);		
		json.putAll(ConvertUtil.objectcollect2json(list, count));
	}
}
